﻿using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using WalkingTec.Mvvm.Core;
using System.Text.Json.Serialization;
using Digitalmes.Model;

namespace Digitalmes.Model.WmsManagement
{
    /// <summary>
    /// 物料档案
    /// </summary>
	[Table("MaterialDoc")]

    [Display(Name = "_Model.MaterialDoc")]
    public class MaterialDoc : BasePoco,IPersistPoco,ITenant
    {
        [Key]
        [Display(Name = "_Model._MaterialDoc._ID")]
        [Required(ErrorMessage = "Validate.{0}required")]
        public new long ID { get; set; }
        [Display(Name = "_Model._MaterialDoc._Code")]
        [Comment("物料编码")]
        [Required(ErrorMessage = "Validate.{0}required")]
        public string Code { get; set; }
        [Display(Name = "_Model._MaterialDoc._Name")]
        [Comment("物料名称")]
        public string Name { get; set; }
        [Display(Name = "_Model._MaterialDoc._ErpCode")]
        [Comment("Erp编码")]
        public string ErpCode { get; set; }
        [Display(Name = "_Model._MaterialDoc._MaterialProperty")]
        [Comment("物料属性")]
        [Required(ErrorMessage = "Validate.{0}required")]
        public MaterialPropertyEnum? MaterialProperty { get; set; }
        [Display(Name = "_Model._MaterialDoc._Spec")]
        [Comment("物料规格")]
        [Required(ErrorMessage = "Validate.{0}required")]
        public string Spec { get; set; }
        [Display(Name = "_Model._MaterialDoc._Unit")]
        [Comment("计量单位")]
        public string Unit { get; set; }
        [Display(Name = "_Model._MaterialDoc._MaterialType")]
        [Comment("物料类型")]
        [Required(ErrorMessage = "Validate.{0}required")]
        public MaterialClassifyEnum? MaterialType { get; set; }
        [Display(Name = "_Model._MaterialDoc._Rules")]
        [Comment("条码校验规则")]
        public string Rules { get; set; }
        [Display(Name = "_Model._MaterialDoc._Expiration")]
        [Comment("保质期")]    
        public int? Expiration { get; set; }
        [Display(Name = "_Model._MaterialDoc._SupplierId")]
        [Comment("物料供应商")]
        public long? SupplierId { get; set; }
        [Display(Name = "_Model._MaterialDoc._Supplier")]
        [Comment("物料供应商")]
        public string Supplier { get; set; }
        [Display(Name = "_Model._MaterialDoc._Active")]
        [Comment("激活")]
        public bool? Active { get; set; }
        [Display(Name = "_Model._MaterialDoc._Pos")]
        [Comment("存放位置")]
        public string Pos { get; set; }

        [Display(Name = "_Model._Warehouse._Name")]
        public long? WarehouseId { get; set; }

        public Warehouse Warehouse  { get; set; }   


        [Display(Name = "_Model._MaterialDoc._MinStore")]
        [Comment("最低库存")]
        [Precision(18,2)]
        public decimal? MinStore { get; set; }
        [Display(Name = "_Model._MaterialDoc._MaxStore")]
        [Comment("最高库存")]
        [Precision(18,2)]
        public decimal? MaxStore { get; set; }
        [Display(Name = "_Model._MaterialDoc._EnableMin")]
        [Comment("最小预警")]
        public bool? EnableMin { get; set; }
        [Display(Name = "_Model._MaterialDoc._IsValid")]
        [Comment("是否有效")]
        [Required(ErrorMessage = "Validate.{0}required")]
        public bool IsValid { get; set; } = true;
        [StringLength(50, ErrorMessage = "Validate.{0}stringmax{1}")]
        public string TenantCode { get; set; }

	}

}
